/**
 * Copyright 2002 Cordys R&D B.V. 
 * 
 * This file is part of the Cordys .NET Connector. 
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.eibus.applicationconnector.dotnet;

import com.eibus.localization.ILocalizableString;
import com.eibus.soap.ApplicationTransaction;
import com.eibus.soap.ApplicationConnector;
import com.eibus.soap.Processor;
import com.eibus.soap.SOAPTransaction;
import com.eibus.util.logger.CordysLogger;
import com.eibus.applicationconnector.dotnet.localization.message.Messages;

/**
  *   This class return the Transaction (dotnetTransaction) object.
  *         SoapTransaction will call canProcess and Process method in that.
  *     That will delegate the call to the .NET
  */
public class DotNetCallHandler  extends ApplicationConnector
{

	static CordysLogger dotnetLogger = CordysLogger.getCordysLogger(DotNetCallHandler.class);

	public ApplicationTransaction createTransaction(SOAPTransaction soapTransaction)
	{
		 return new Transaction();
	}

	public void open(Processor procssor)
	{
		if (dotnetLogger.isDebugEnabled())
			dotnetLogger.debug("Dotnet  application connector opened");

	}


	public void close(Processor processor)
	{
	}

	static
	{
		 System.loadLibrary("jnet");
		 if (dotnetLogger.isDebugEnabled())
		 	dotnetLogger.debug("Loaded the library jnet.dll");
	}
	
	/**
	 * Returns the description of this application connector, suitable for usage in a management tool.
	 * 
	 * @return the name of this application connector, suitable for usage in a management tool.
	 */
	protected ILocalizableString getManagementDescription() 
	{
		return Messages.DOTNET_CONNECTOR_DESCRIPTION;
	}
	
	/**
	 * Returns the name of this application connector, suitable for usage in a management tool.
	 * 
	 * @return the name of this application connector, suitable for usage in a management tool.
	 */
	protected String getManagementName() 
	{
		return ".Net call application connector";
	}
}
